home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / dragon-runner.swf / scripts / ScoreManager.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  5.0 KB  |  169 lines

  1. package
  2. {
  3.    import flash.display.Sprite;
  4.    import flash.events.Event;
  5.    import flash.text.*;
  6.    
  7.    public class ScoreManager extends Sprite
  8.    {
  9.        
  10.       
  11.       private var ┬º\x01\x01\x02\t┬º:* = null;
  12.       
  13.       private var ┬º\x01\x01\x07\x0b┬º:Boolean = false;
  14.       
  15.       internal const INITARMOR:* = 100;
  16.       
  17.       internal const HEALTHBARY:* = -10;
  18.       
  19.       internal const DOC_HEIGHT:* = 400;
  20.       
  21.       internal const SCOREBARX:* = 445;
  22.       
  23.       internal const SCOREBARY:* = 0;
  24.       
  25.       private var armor:int = 0;
  26.       
  27.       internal const HEALTHBARX:* = 445;
  28.       
  29.       internal const INITSCORE:* = 0;
  30.       
  31.       internal const ARMORBARX:* = 460;
  32.       
  33.       internal const ARMORBARY:* = -40;
  34.       
  35.       internal const INITHEALTH:* = 100;
  36.       
  37.       private var ┬º\x01\x01\x07\r┬º:TextField;
  38.       
  39.       internal const DOC_TOP:* = 0;
  40.       
  41.       private var ┬º\x01\x01\x07\x0e┬º:int = 0;
  42.       
  43.       internal const BARWIDTH:* = 160;
  44.       
  45.       private var ┬º\x01\x01\x07\x0f┬º:* = null;
  46.       
  47.       private var health:int = 0;
  48.       
  49.       internal const DOC_WIDTH:* = 640;
  50.       
  51.       internal const DOC_LEFT:* = 0;
  52.       
  53.       internal const BARHEIGHT:* = 30;
  54.       
  55.       private var ┬º\x01\x01\b\x02┬º:* = null;
  56.       
  57.       private var ┬º\x01\x01\x06\b┬º:* = null;
  58.       
  59.       public function ScoreManager(param1:*, param2:*)
  60.       {
  61.          ┬º\x01\x01\x02\t┬º = null;
  62.          ┬º\x01\x01\x06\b┬º = null;
  63.          ┬º\x01\x01\x07\x0f┬º = null;
  64.          ┬º\x01\x01\b\x02┬º = null;
  65.          health = 0;
  66.          armor = 0;
  67.          ┬º\x01\x01\x07\x0e┬º = 0;
  68.          ┬º\x01\x01\x07\x0b┬º = false;
  69.          ┬º\x01\x01\x07\r┬º = new TextField();
  70.          super();
  71.          ┬º\x01\x01\x02\t┬º = param1;
  72.          ┬º\x01\x01\x06\b┬º = param2.GetMenuContainer();
  73.          ┬º\x01\x01\x07\x0b┬º = false;
  74.       }
  75.       
  76.       public function GetScore() : int
  77.       {
  78.          return ┬º\x01\x01\x07\x0e┬º;
  79.       }
  80.       
  81.       public function SetArmor(param1:*) : *
  82.       {
  83.          armor = param1;
  84.       }
  85.       
  86.       public function StopGame() : *
  87.       {
  88.          if(┬º\x01\x01\x07\x0b┬º)
  89.          {
  90.             ┬º\x01\x01\b\x01┬º();
  91.             ┬º\x01\x01\x07\x0b┬º = false;
  92.          }
  93.       }
  94.       
  95.       public function SetHealth(param1:*) : *
  96.       {
  97.          health = param1;
  98.       }
  99.       
  100.       private function ┬º\x01\x01\x07\f┬º() : *
  101.       {
  102.          var _loc1_:TextFormat = null;
  103.          health = INITHEALTH;
  104.          armor = INITARMOR;
  105.          ┬º\x01\x01\x07\x0e┬º = INITSCORE;
  106.          ┬º\x01\x01\x07\r┬º.width = BARWIDTH;
  107.          ┬º\x01\x01\x07\r┬º.height = BARHEIGHT * 2;
  108.          ┬º\x01\x01\x07\r┬º.x = SCOREBARX;
  109.          ┬º\x01\x01\x07\r┬º.y = SCOREBARY;
  110.          ┬º\x01\x01\x07\r┬º.type = TextFieldType.DYNAMIC;
  111.          ┬º\x01\x01\x07\r┬º.multiline = true;
  112.          ┬º\x01\x01\x07\r┬º.wordWrap = true;
  113.          ┬º\x01\x01\x07\r┬º.background = false;
  114.          ┬º\x01\x01\x07\r┬º.border = false;
  115.          _loc1_ = new TextFormat();
  116.          _loc1_.font = "Verdana";
  117.          _loc1_.color = 13421772;
  118.          _loc1_.size = 16;
  119.          _loc1_.bold = true;
  120.          _loc1_.align = "right";
  121.          ┬º\x01\x01\x07\r┬º.defaultTextFormat = _loc1_;
  122.          ┬º\x01\x01\x07\r┬º.text = "Score: " + ┬º\x01\x01\x07\x0e┬º;
  123.          ┬º\x01\x01\x06\b┬º.addChild(┬º\x01\x01\x07\r┬º);
  124.          ┬º\x01\x01\x07\x0f┬º = new healthbar();
  125.          ┬º\x01\x01\x07\x0f┬º.x = HEALTHBARX;
  126.          ┬º\x01\x01\x07\x0f┬º.y = HEALTHBARY;
  127.          ┬º\x01\x01\x07\x0f┬º.width = BARWIDTH;
  128.          ┬º\x01\x01\x07\x0f┬º.height = BARHEIGHT;
  129.          ┬º\x01\x01\x06\b┬º.addChild(┬º\x01\x01\x07\x0f┬º);
  130.          ┬º\x01\x01\b\x02┬º = new armorbar();
  131.          ┬º\x01\x01\b\x02┬º.x = ARMORBARX;
  132.          ┬º\x01\x01\b\x02┬º.y = ARMORBARY;
  133.          ┬º\x01\x01\b\x02┬º.width = BARWIDTH;
  134.          ┬º\x01\x01\b\x02┬º.height = BARHEIGHT;
  135.          ┬º\x01\x01\x06\b┬º.addChild(┬º\x01\x01\b\x02┬º);
  136.          ┬º\x01\x01\x02\t┬º.addEventListener(Event.ENTER_FRAME,┬º\x01\x01\x07\x10┬º,false,0,true);
  137.       }
  138.       
  139.       public function StartGame() : *
  140.       {
  141.          if(!┬º\x01\x01\x07\x0b┬º)
  142.          {
  143.             ┬º\x01\x01\x07\f┬º();
  144.             ┬º\x01\x01\x07\x0b┬º = true;
  145.          }
  146.       }
  147.       
  148.       public function SetScore(param1:*) : *
  149.       {
  150.          ┬º\x01\x01\x07\x0e┬º += param1;
  151.       }
  152.       
  153.       private function ┬º\x01\x01\x07\x10┬º(param1:Event) : *
  154.       {
  155.          ┬º\x01\x01\x07\x0f┬º.gotoAndStop(101 - health);
  156.          ┬º\x01\x01\b\x02┬º.gotoAndStop(101 - armor);
  157.          ┬º\x01\x01\x07\r┬º.text = "Score: " + ┬º\x01\x01\x07\x0e┬º++;
  158.       }
  159.       
  160.       private function ┬º\x01\x01\b\x01┬º() : *
  161.       {
  162.          ┬º\x01\x01\x06\b┬º.removeChild(┬º\x01\x01\x07\r┬º);
  163.          ┬º\x01\x01\x06\b┬º.removeChild(┬º\x01\x01\x07\x0f┬º);
  164.          ┬º\x01\x01\x06\b┬º.removeChild(┬º\x01\x01\b\x02┬º);
  165.          ┬º\x01\x01\x02\t┬º.removeEventListener(Event.ENTER_FRAME,┬º\x01\x01\x07\x10┬º);
  166.       }
  167.    }
  168. }
  169.